﻿using CIS.DB;
using CIS.Web.Common;
using CIS.Web.Controllers;
using System;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Mvc;
using static CIS.Web.Common.ConstValues;

namespace CIS.Web.Filters
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
	public class CISAuthorizeAttribute : AuthorizeAttribute
	{
		public override void OnAuthorization(AuthorizationContext filterContext)
		{
			base.OnAuthorization(filterContext);
		}

		protected override bool AuthorizeCore(HttpContextBase httpContext)
		{
			if (httpContext.User.Identity.IsAuthenticated)
			{
				string actionName = httpContext.Request.RequestContext.RouteData.Values["action"].ToString();
				if (!actionName.Equals("Logoff", StringComparison.OrdinalIgnoreCase))
				{
					//get user role
					using (CISEntities dbContext = new CISEntities())
					{
						var principal = new CISPrincipal(httpContext.User.Identity);

						principal.IP = GetRealIP(httpContext) == "::1" ? DefaultIP : GetRealIP(httpContext);

						var userMaster = dbContext.SysUserMaster.AsNoTracking()
								.FirstOrDefault(x => x.UserName == httpContext.User.Identity.Name);
						principal.UserID = userMaster.ID;
						principal.UserName = userMaster.UserName;
						principal.Email = userMaster.Mail;
						principal.Language = userMaster.Language;

						//principal.Language = httpContext.Request.Cookies["_culture"] != null ?
						//		httpContext.Request.Cookies["_culture"].Value :
						//			!string.IsNullOrEmpty(userMaster.Language) ?
						//			userMaster.Language : Language.Cn;

						var viewUserRoleAction = dbContext.ViewUserRoleAction.AsNoTracking()
								.Where(x => x.UserName == httpContext.User.Identity.Name)
								.ToList();

						viewUserRoleAction.ForEach(x =>
						{
							principal.UserRoleActions.Add(new UserRoleAction
							{
								UserID = x.UserID,
								UserName = x.UserName,
								RoleID = x.RoleID,
								RoleName = x.RoleName,
								ActionID = x.ActionID,
								FunctionID = x.FunctionID,
								Browse = x.Browse,
								Add = x.Add,
								Modify = x.Modify,
								Delete = x.Delete
							});
						});

						if (viewUserRoleAction.Count(x => x.RoleName == SA) > 0)
						{
							principal.IsSSA = true;
						}

						if (viewUserRoleAction.Count() > 0)
						{
							principal.IsSA = true;
						}

						var viewConferenceRoleAction = dbContext.ViewConferenceRoleAction.AsNoTracking()
								.Where(x => x.UserName == httpContext.User.Identity.Name)
								.ToList();

						viewConferenceRoleAction.ForEach(x =>
						{
							principal.ConferenceRoleActions.Add(new ConferenceRoleAction
							{
								UserID = x.UserID,
								UserName = x.UserName,
								ConferenceID = x.ConferenceID,
								RoleID = x.RoleID,
								RoleName = x.RoleName,
								ActionID = x.ActionID,
								FunctionID = x.FunctionID,
								Browse = x.Browse,
								Add = x.Add,
								Modify = x.Modify,
								Delete = x.Delete
							});
						});

						viewConferenceRoleAction.Where(x => x.RoleName == CA).ToList().ForEach(x =>
						{
							principal.CSAList.Add(x.ConferenceID);
						});

						if (viewConferenceRoleAction.Count() > 0)
						{
							principal.IsCA = true;
						}

						HttpContext.Current.User = principal;
					}

					if (!Authorize(httpContext))
					{
						return false;
					}
				}
			}

			return base.AuthorizeCore(httpContext);
		}

		private bool Authorize(HttpContextBase httpContext)
		{
			string controllerName = httpContext.Request.RequestContext.RouteData.Values["controller"].ToString();
			string actionName = httpContext.Request.RequestContext.RouteData.Values["action"].ToString();
			var user = httpContext.User as ICISPrincipal;

			controllerName = controllerName + "Controller";

			if (user.IsSSA)
			{
				return true;
			}

			#region 共通
			if (nameof(HomeController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}

			if (nameof(UtilityController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			#endregion

			#region 个人用户中心
			if (nameof(ProfileEditController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (nameof(ProfileAttendenceInfoController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (nameof(ProfileContributeInfoController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (nameof(ProfileConferenceAttendPayController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (nameof(ProfilePaymentController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (nameof(ProfileVisaController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (nameof(ProfileQuizController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (nameof(ProfileInvoiceController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (nameof(ProfileHotelController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (nameof(ProfileTrafficController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (nameof(MeetingListController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (nameof(MeetingListLogoutController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (nameof(MeetingApplyController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (nameof(MeetingContributeController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (nameof(MeetingAttendenceController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (nameof(MeetingBookingController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (nameof(MeetingFeedbackController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			#endregion

			#region 会议管理
			if (nameof(ConferenceHomeController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				if (!user.IsCA)
				{
					return false;
				}
				return true;
			}
			if (nameof(ConferenceInfoController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceInfoController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceInfo, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceInfoController.Edit).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceInfo, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceFunctionController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceFunctionController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceFunction, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceFunctionController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceFunctionController.ModifyAll).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceFunction, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceLocaleController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceLocaleController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceLocaleRegister, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				//添加权限：现场工作人员
				if (nameof(ConferenceLocaleController.SaveLocaleManage).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceLocaleController.SaveLocaleManageSendMail).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceLocaleController.UploadBackground).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceLocaleController.SavePrintSetting).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceLocaleRegister, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				//修改权限：财务
				if (nameof(ConferenceLocaleController.SaveInvoiceInfo).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceLocaleController.Import).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceLocaleRegister, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceAttendenceInfoController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceAttendenceInfoController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceAttendenceInfo, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceAttendenceInfoController.Import).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceAttendenceInfo, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceAttendenceInfoController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceAttendenceInfoController.CreateOtherFee).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceAttendenceInfoController.DeleteOtherFee).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceAttendenceInfo, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceAttendenceInfoController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceAttendenceInfo, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceTransferEvidenceController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceTransferEvidenceController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTransferEvidence, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceTransferEvidenceController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTransferEvidence, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceVisaController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceVisaController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceVisa, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceVisaController.Upload).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceVisa, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceVisaController.SendMail).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceVisa, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceVisaController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceVisa, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceConcurrentEventAndFeeController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceConcurrentEventAndFeeController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceConcurrentEventAndFee, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceConcurrentEventAndFeeController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceConcurrentEventAndFee, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceConcurrentEventAndFeeController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceConcurrentEventAndFee, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceConcurrentEventAndFeeController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceConcurrentEventAndFee, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceAttendenceFormController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceAttendenceFormController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceAttendenceForm, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceAttendenceFormController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceAttendenceForm, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceAttendenceFormController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceAttendenceForm, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceAttendenceFormController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceAttendenceForm, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceTitleController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceTitleController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTitle, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceTitleController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTitle, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceTitleController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTitle, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceTitleController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTitle, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceAttendIdentityController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceAttendIdentityController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceAttendIdentity, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceAttendIdentityController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceAttendIdentity, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceAttendIdentityController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceAttendIdentity, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceAttendIdentityController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceAttendIdentity, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferencePaymentController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferencePaymentController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferencePayment, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferencePaymentController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferencePayment, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferencePaymentController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase)
					|| nameof(ConferencePaymentController.CreateAli).Equals(actionName, StringComparison.OrdinalIgnoreCase)
					|| nameof(ConferencePaymentController.CreateE).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferencePayment, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferencePaymentController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferencePayment, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceFeeAttendController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceFeeAttendController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceFeeAttend, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceFeeAttendController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceFeeAttend, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceFeeAttendController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceFeeAttend, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceFeeAttendController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceFeeAttend, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceFeePageController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceFeePageController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceFeePage, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceFeePageController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceFeePage, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceFeePageController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceFeePage, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceFeePageController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceFeePage, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceFeeMealController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceFeeMealController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceFeeMeal, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceFeeMealController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceFeeMeal, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceFeeMealController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceFeeMeal, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceFeeMealController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceFeeMeal, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceFeeOtherController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceFeeOtherController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceFeeOther, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceFeeOtherController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceFeeOther, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceFeeOtherController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceFeeOther, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceFeeOtherController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceFeeOther, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceEventInformationController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceEventInformationController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceEventInformation, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceInvoiceController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceInvoiceController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceInvoice, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceInvoiceController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceInvoice, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceInvoiceController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceInvoice, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceInvoiceController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceInvoice, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceContributeInfoController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceContributeInfoController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceContributeInfo, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceContributeInfoController.Import).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceContributeInfo, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceContributeInfoController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceContributeInfoController.CreateAuthor).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceContributeInfoController.DeleteAuthor).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceContributeInfoController.ChangeContactAuthor).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceContributeInfoController.ChangePresenter).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceContributeInfo, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceContributeInfoController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceContributeInfo, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceNoticeController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceNoticeController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceNotice, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceNoticeController.Edit).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceNoticeController.Preview).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceNotice, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceContributeFormController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceContributeFormController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceContributeForm, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceContributeFormController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceContributeForm, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceContributeFormController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceContributeForm, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceContributeFormController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceContributeForm, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceTopicController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceTopicController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTopic, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceTopicController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTopic, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceTopicController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTopic, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceTopicController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTopic, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceEssayTypeController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceEssayTypeController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceEssayType, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceEssayTypeController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceEssayType, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceEssayTypeController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceEssayType, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceEssayTypeController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceEssayType, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceReportTypeController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceReportTypeController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceReportType, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceReportTypeController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceReportType, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceReportTypeController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceReportType, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceReportTypeController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceReportType, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceTargetJournalController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceTargetJournalController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTargetJournal, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceTargetJournalController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTargetJournal, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceTargetJournalController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTargetJournal, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceTargetJournalController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTargetJournal, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceOcisController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceOcisController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceOcis, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceOcisController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceOcis, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceOcisController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceOcis, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceOcisController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceOcis, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceAwardsController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceAwardsController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceAwards, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceAwardsController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceAwards, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceAwardsController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceAwards, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceAwardsController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceAwards, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceReviewController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceReviewController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceReview, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceReviewController.AdminModify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceReviewPersonController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceReviewPersonController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceReviewPerson, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceReviewPersonController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceReviewPerson, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceReviewPersonController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceReviewPersonController.SaveDistribution).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceReviewPersonController.SaveFinal).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceReviewPerson, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceReviewPersonController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceReviewPerson, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceHotelEditController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceHotelEditController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceHotelEdit, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceHotelEditController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceHotelEdit, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceHotelEditController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceHotelEditController.CreateRoom).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceHotelEditController.ModifyRoom).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceHotelEdit, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceHotelEditController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceHotelEditController.DeleteRoom).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceHotelEdit, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceCheckInController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceCheckInController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceCheckIn, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceCheckInController.AddHotel).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceCheckIn, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceCheckInController.Import).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceCheckIn, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceCheckInController.EditHotel).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceCheckIn, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceCheckInController.CancelBooking).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceCheckIn, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceCheckInController.SetBooking).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceCheckIn, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceTrafficController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceTrafficController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTraffic, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceTrafficController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTraffic, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceTrafficController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTraffic, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceTrafficController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTraffic, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceTrafficInfoController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceTrafficInfoController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTrafficInfo, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceTrafficInfoController.EditTraffic).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTrafficInfo, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceTrafficInfoController.CancelBooking).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTrafficInfo, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceTrafficInfoController.SetBooking).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceTrafficInfo, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceMenuController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceMenuController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceMenu, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceMenuController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceMenu, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceMenuController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceMenuController.CreateSecondData).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceMenuController.ModifySecondData).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceMenuController.DeleteSecondData).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceMenu, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceMenuController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceMenu, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceNewsListController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceNewsListController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceNewsList, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceNewsListController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceNewsList, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceNewsListController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceNewsList, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceNewsListController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceNewsList, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceNewsController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceNewsController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceNews, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceNewsController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceNews, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceNewsController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceNews, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceNewsController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceNews, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceQuizController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceQuizController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceQuiz, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceQuizController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceQuiz, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceQuizController.CreateQuestion).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceQuizController.DeleteQuestion).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceQuiz, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceQuizController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceQuiz, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceMailServerController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceMailServerController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceMailServer, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceMailServerController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceMailServer, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceMailServerController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceMailServer, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceMailServerController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceMailServer, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceMailController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceMailController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceMail, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceMailController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceMail, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceStatisticsController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceStatisticsController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceStatistics, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceActionMasterController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceActionMasterController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceActionMaster, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceActionMasterController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceActionMaster, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceActionMasterController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceActionMaster, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceActionMasterController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceActionMaster, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceRoleMasterController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceRoleMasterController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceRoleMaster, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceRoleMasterController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceRoleMaster, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceRoleMasterController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceRoleMasterController.CreateAction).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceRoleMasterController.DeleteAction).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceRoleMaster, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceRoleMasterController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceRoleMaster, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceUserGroupMasterController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceUserGroupMasterController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceUserGroupMaster, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceUserGroupMasterController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceUserGroupMaster, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceUserGroupMasterController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceUserGroupMasterController.CreateRole).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceUserGroupMasterController.DeleteRole).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceUserGroupMasterController.DeleteUser).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceUserGroupMaster, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceUserGroupMasterController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceUserGroupMaster, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceUserMasterController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceUserMasterController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceUserMaster, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceUserMasterController.CreateRoleAndGroup).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceUserMaster, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceUserMasterController.CreateAction).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceUserMasterController.DeleteAction).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceUserMasterController.CreateGroup).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceUserMasterController.DeleteGroup).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceUserMaster, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceLogInfoController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceLogInfoController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceLogInfo, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceScheduleController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceScheduleController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceSchedule, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceScheduleController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceSchedule, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceScheduleController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceScheduleController.CreateDateReport).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceScheduleController.ModifyDateReport).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceScheduleController.DeleteDateReport).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceScheduleController.UpdateChairman).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceScheduleController.DeleteChairman).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceSchedule, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceScheduleController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceSchedule, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceScheduleEventController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceScheduleEventController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceScheduleEvent, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceScheduleEventController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceScheduleEventController.Import).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceScheduleEvent, RoleType.添加) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceScheduleEventController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceScheduleEvent, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceScheduleEventController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceScheduleEvent, RoleType.删除) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			if (nameof(ConferenceScheduleReportController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				string conferenceId = httpContext.Request.RequestContext.RouteData.Values["conferenceId"] == null ?
						string.Empty : httpContext.Request.RequestContext.RouteData.Values["conferenceId"].ToString();
				if (nameof(ConferenceScheduleReportController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceScheduleReport, RoleType.浏览) || user.CSAList.Contains(conferenceId);
				}
				if (nameof(ConferenceScheduleReportController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceScheduleReportController.ChangeConfirm).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(ConferenceScheduleReportController.SaveLogData).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasConferenceRole(user, conferenceId, FunctionId.ConferenceScheduleReport, RoleType.修改) || user.CSAList.Contains(conferenceId);
				}
				return true;
			}
			#endregion

			#region 系统管理
			if (nameof(SysMailServerController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				if (nameof(SysMailServerController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysMailServer, RoleType.浏览);
				}
				if (nameof(SysMailServerController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysMailServer, RoleType.添加);
				}
				if (nameof(SysMailServerController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysMailServer, RoleType.修改);
				}
				if (nameof(SysMailServerController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysMailServer, RoleType.删除);
				}

				return true;
			}
			if (nameof(SysPaymentController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				if (nameof(SysPaymentController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysPayment, RoleType.浏览);
				}
				if (nameof(SysPaymentController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysPayment, RoleType.添加);
				}
				if (nameof(SysPaymentController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysPayment, RoleType.修改);
				}
				if (nameof(SysPaymentController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysPayment, RoleType.删除);
				}
				return true;
			}
			if (nameof(SysInvoiceController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				if (nameof(SysInvoiceController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysInvoiceMaster, RoleType.浏览);
				}
				if (nameof(SysInvoiceController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(SysInvoiceController.Import).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysInvoiceMaster, RoleType.添加);
				}
				if (nameof(SysInvoiceController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysInvoiceMaster, RoleType.修改);
				}
				if (nameof(SysInvoiceController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysInvoiceMaster, RoleType.删除);
				}
				return true;
			}
			if (nameof(SysConferenceModelController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				if (nameof(SysConferenceModelController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysPayment, RoleType.浏览);
				}
				if (nameof(SysConferenceModelController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysPayment, RoleType.修改);
				}

				return true;
			}
			if (nameof(SysConferenceMasterController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				if (nameof(SysConferenceMasterController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysConferenceMaster, RoleType.浏览);
				}
				if (nameof(SysConferenceMasterController.Verify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysConferenceMaster, RoleType.修改);
				}
				if (nameof(SysConferenceMasterController.Edit).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysConferenceMaster, RoleType.修改);
				}
				if (nameof(SysConferenceMasterController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysConferenceMaster, RoleType.删除);
				}

				return true;
			}
			if (nameof(SysConferenceFunctionMasterController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				if (nameof(SysConferenceFunctionMasterController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysConferenceMaster, RoleType.浏览);
				}
				if (nameof(SysConferenceFunctionMasterController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.ConferenceFunction, RoleType.修改);
				}
				return true;
			}
			if (nameof(SysUserMasterController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				if (nameof(SysUserMasterController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysUserMaster, RoleType.浏览);
				}
				if (nameof(SysUserMasterController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(SysUserMasterController.Import).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysUserMaster, RoleType.添加);
				}
				if (nameof(SysUserMasterController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(SysUserMasterController.CreateRole).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(SysUserMasterController.DeleteRole).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(SysUserMasterController.CreateGroup).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(SysUserMasterController.DeleteGroup).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysUserMaster, RoleType.修改);
				}
				if (nameof(SysUserMasterController.DeleteUser).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysUserMaster, RoleType.删除);
				}
				return true;
			}
			if (nameof(SysUserGroupMasterController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				if (nameof(SysUserGroupMasterController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysUserGroupMaster, RoleType.浏览);
				}
				if (nameof(SysUserGroupMasterController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysUserGroupMaster, RoleType.添加);
				}
				if (nameof(SysUserGroupMasterController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(SysUserGroupMasterController.CreateRole).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(SysUserGroupMasterController.DeleteRole).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(SysUserGroupMasterController.DeleteUser).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysUserGroupMaster, RoleType.修改);
				}
				if (nameof(SysUserGroupMasterController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysUserGroupMaster, RoleType.删除);
				}
				return true;
			}
			if (nameof(SysRoleMasterController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				if (nameof(SysRoleMasterController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysRoleMaster, RoleType.浏览);
				}
				if (nameof(SysRoleMasterController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysRoleMaster, RoleType.添加);
				}
				if (nameof(SysRoleMasterController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(SysRoleMasterController.CreateAction).Equals(actionName, StringComparison.OrdinalIgnoreCase) ||
					nameof(SysRoleMasterController.DeleteAction).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysRoleMaster, RoleType.修改);
				}
				if (nameof(SysRoleMasterController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysRoleMaster, RoleType.删除);
				}
				return true;
			}
			if (nameof(SysActionMasterController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				if (nameof(SysActionMasterController.Index).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysActionMaster, RoleType.浏览);
				}
				if (nameof(SysActionMasterController.Create).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysActionMaster, RoleType.添加);
				}
				if (nameof(SysActionMasterController.Modify).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysActionMaster, RoleType.修改);
				}
				if (nameof(SysActionMasterController.Delete).Equals(actionName, StringComparison.OrdinalIgnoreCase))
				{
					return Utility.HasSystemRole(user, FunctionId.SysActionMaster, RoleType.删除);
				}
				return true;
			}
			if (nameof(SysStatisticsController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (nameof(SysLogInfoController).Equals(controllerName, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			#endregion

			return false;
		}

		private string GetRealIP(HttpContextBase httpContext)
		{
			string result = string.Empty;
			result = httpContext.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
			//可能有代理   
			if (!string.IsNullOrWhiteSpace(result))
			{
				//没有"." 肯定是非IP格式  
				if (result.IndexOf(".") == -1)
				{
					result = null;
				}
				else
				{
					//有","，估计多个代理。取第一个不是内网的IP。  
					if (result.IndexOf(",") != -1)
					{
						result = result.Replace(" ", string.Empty).Replace("\"", string.Empty);

						string[] temparyip = result.Split(",;".ToCharArray());

						if (temparyip != null && temparyip.Length > 0)
						{
							for (int i = 0; i < temparyip.Length; i++)
							{
								//找到不是内网的地址  
								if (IsIPAddress(temparyip[i]) && temparyip[i].Substring(0, 3) != "10." && temparyip[i].Substring(0, 7) != "192.168" && temparyip[i].Substring(0, 7) != "172.16.")
								{
									return temparyip[i];
								}
							}
						}
					}
					//代理即是IP格式  
					else if (IsIPAddress(result))
					{
						return result;
					}
					//代理中的内容非IP  
					else
					{
						result = null;
					}
				}
			}

			if (string.IsNullOrWhiteSpace(result))
			{
				result = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
			}

			if (string.IsNullOrWhiteSpace(result))
			{
				result = HttpContext.Current.Request.UserHostAddress;
			}
			return result;
		}

		private bool IsIPAddress(string str)
		{
			if (string.IsNullOrWhiteSpace(str) || str.Length < 7 || str.Length > 15)
				return false;

			string regformat = @"^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})";
			Regex regex = new Regex(regformat, RegexOptions.IgnoreCase);

			return regex.IsMatch(str);
		}
	}
}